<?php


namespace app\index\business;


use app\common\model\Advertising;
use app\common\model\Banner;
use app\common\model\ConsignorItem;
use app\common\model\Link;
use app\common\model\MemberInfo;
use app\common\model\News;
use app\common\model\Notice;

class indexBus
{
    public $memberInfoModel = null;
    public $consignorItem = null;
    public $newsModel = null;
    public $noticeModel = null;
    public $linkModel = null;
    public $bannerModel = null;
    public $advertising = null;
    public function __construct()
    {
        $this->memberInfoModel = new MemberInfo();
        $this->consignorItem = new ConsignorItem();
        $this->newsModel = new News();
        $this->noticeModel = new Notice();
        $this->linkModel = new Link();
        $this->bannerModel = new Banner();
        $this->advertising = new Advertising();
    }

    /**
     * 首页获取最新的会员注册
     * @param $num 获取多少条数
     */
    public function getNewMemberInfoListBus($num){
        $where = [
            'status'=>1
        ];
        $res = $this->memberInfoModel->getMemberLimitList($where,$num);
        return $res;
    }

    /**
     * 首页获取最新招标和货源
     * @param $num
     * @param $item_category
     * @return mixed
     */
    public function getConsignorItemOneListBus($num,$item_category){
        $where = [
            'status'=>2,
            'item_category'=>$item_category
        ];
        $res = $this->consignorItem->getLimitList($where,$num);
        return $res;
    }

    public function getNewsLimitListBus($num){
        $where = [
            'status'=>1,
            'commend_flag'=>1
        ];
        $res = $this->newsModel->getLimitListByWhere($where,$num);
        return $res;
    }
    public function getNoticeLimitListBus($num){
        $where = [
            'status'=>1,
            'commend_flag'=>1
        ];
        $res = $this->noticeModel->getLimitListByWhere($where,$num);
        return $res;
    }
    public function getLinkLimitListBus($num){
        $where = [
            'status'=>1,
        ];
        $res = $this->linkModel->getLimitListByWhere($where,$num);
        return $res;
    }

    public function getBannerLimitListBus($num){
        $where = [
            'status'=>1,
        ];
        $res = $this->bannerModel->getLimitListByWhere($where,$num);
        return $res;
    }
    public function getConsignorLimitListBus($num){
        $where = [
            'status'=>1,
            'member_category' => 1,
            'commend_flag' => 1
        ];
        $res = $this->memberInfoModel->getMemberLimitList($where,$num);
        return $res;
    }
    public function getLogisticsLimitListBus($num){
        $where = [
            'status'=>1,
            'member_category' => 2,
            'commend_flag' => 1
        ];
        $res = $this->memberInfoModel->getMemberLimitList($where,$num);
        return $res;
    }
    public function getAdvertisingLimitListBus($where){
        $res = $this->advertising->getDetailByWhere($where);
        return $res;
    }

}